home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Essentials / rTutors / part2.5 / rTutor.rez < prev    next >
Encoding:
Text File  |  1990-06-19  |  8.5 KB  |  365 lines  |  [TEXT/pdos]

  1. /* File: Rtutor.Rez */
  2. /* Rez source file for C version of resource tutorial */
  3. /* Part 1:  starting up & shutting down the tools using a resource */
  4. /* Part 2:  do Part 1 and insert a menubar with menus */
  5. /* Part 2.5:  do part 2 and add an event loop so app stays up */
  6.  
  7. /* this gives use access to the "standard" pre-defined resource types */
  8. #include "Types.rez"
  9.  
  10. /*---------------------- Startup Record ---------------------------*/
  11. resource rToolStartup (1)
  12. {
  13.  $C080,       /* set master SCB to mode640 + fFastPortAware + fUseShadowing */
  14.  {
  15.   3,$0300,      /* misc tools */
  16.   4,$0302,      /* quickdraw */
  17.   5,$0302,      /* desk manager */
  18.   6,$0300,      /* eventMgr */
  19. /*  7,$0300,      /* scheduler */ /* not used by apps or DA's */
  20. /*  8,$0301,      /* sound tools */ /* not used by this app */
  21. /*  9,$0300,      /* ADB tools */ /* not used by this app */
  22. /*  10,$0300,      /* SANE */ /* started already by pStart.obj */
  23.   11,$0300,      /* int math */
  24.   14,$0301,      /* Window Manager */
  25.   15,$0301,      /* Menu Manager */
  26.   16,$0300,      /* Control Manager */
  27.   18,$0301,      /* QD Aux */
  28.   19,$0300,      /* print manager */
  29.   20,$0301,      /* LineEdit tool set */
  30.   21,$0302,      /* Dialog Manager */
  31.   22,$0300,      /* Scrap manager */
  32.   23,$0301,      /* standard file */
  33.   27,$0301,      /* Font manager */
  34.   28,$0301,      /* list manager */
  35.   34,$0101,      /* text edit */
  36. /*  29,$0100,      /* ACE */ /* not used by this app */
  37. /*  32,$0100,      /* Midi Tools */ /* not used by this app */
  38. /*  25,$0100,      /* NoteSynth */ /* not used by this app */
  39. /*  26,$0100      /* Note Seq */ /* not used by this app */
  40.  }
  41. };
  42.  
  43.  
  44. /*---------------------- Menus & Menu Bars ---------------------------*/
  45.     /* define the resource id of the menu bar itself */
  46. #define    kMenuBarID1       1
  47.  
  48.     /* define all the menu id's */
  49. #define    kAppleMID   1000
  50. #define    kFileMID    2000
  51. #define    kEditMID    3000
  52.  
  53.     /* now, define the menu item id's */
  54. #define    kAboutBoxIID    1001 /* the "About..." box */
  55.     
  56. #define    kNewItem        2001 /* the "New" item */
  57. #define    kOpenItem       2002 /* the "Open..." item */
  58. #define    kCloseItem       255 /* the "Close" item */
  59. #define    kSaveItem       2004 /* the "Save" item */
  60. #define    kSaveAsItem     2005 /* the "Save As..." item */
  61. #define    kQuitItem       2009 /* the "Quit" item */
  62.       
  63. #define    kUndoItem        250 /* the "Undo" item */
  64. #define    kCutItem         251 /* the "Cut" item */
  65. #define    kCopyItem        252 /* the "Copy" item */
  66. #define    kPasteItem       253 /* the "Paste" item */
  67. #define    kClearItem       254 /* the "Clear" item */
  68. #define    kSelectItem     3001 /* the "Select All" item */
  69. #define    kShowClipItem   3002 /* the "Show Clipboard" item */
  70.       
  71.     /* now, define the menu bar */
  72. resource rMenuBar (kMenuBarID1)
  73. {
  74.     {
  75.         kAppleMID,
  76.         kFileMID,
  77.         kEditMID,
  78.     };
  79. };
  80.  
  81.  
  82. /* lay out the Apple menu */
  83. /* this takes several steps: */
  84. /* 1)  define the menu itself in a resource of type "rMenu" */
  85. /* 2)  define the rPString that will be used for the name of the menu */
  86. /* 3)  define the first item in the menu in a resource of type "rMenuItem" */
  87. /* 4)  define the rPString that will be used for the name of the first item */
  88. /* 5)  repeat steps 3 and 4 for all remaining items in that menu */
  89. /* 6)  repeat steps 1 through 5 for all remaining menus */
  90.     
  91. resource rMenu (kAppleMID, nocrossbank)
  92. {
  93.     kAppleMID,    /* ID of the menu this item belongs to */
  94.     0xA008, /* flags => menu title is a resource, items are resources, menu */
  95.             /* is enabled, XOR highlighting, std menu, caching ok */
  96.     kAppleMID,    /* ref to menu's title */
  97.     { kAboutBoxIID }; /* array of items in this menu (only 1 to start with) */
  98. };
  99.  
  100. resource rPString (kAppleMID, nocrossbank)
  101. {
  102.     "@"                    /* this string is the title of the "Apple" menu */
  103. };
  104.  
  105. /* see IIGS Toolbox Reference, Volume 3, menu item template */
  106. resource rMenuItem (kAboutBoxIID, nocrossbank)
  107. {
  108.     kAboutBoxIID, /* item's ID */
  109.     "",           /* no keyboard equivalent */
  110.     "",           /* no keyboard equivalent (allowed 2, this is the 2nd) */
  111.     0,            /* this item does not have a check mark by it */
  112.     0x8040,       /* title is in a resource, enabled (bit 7=0), */
  113.                   /* dividing line below (bit 6=1)  */
  114.     kAboutBoxIID  /* ref of the item's title */
  115. };
  116.  
  117. resource rPString (kAboutBoxIID, nocrossbank)
  118. {
  119.     "About rTutor" /* used as the title for the "About..." item */
  120. };
  121.  
  122.  
  123.     /* lay out the File menu */
  124.     
  125. resource rMenu (kFileMID, nocrossbank) /* still haven't put printing in */
  126. {
  127.     kFileMID,  /* ID of the menu this item belongs to */
  128.     0xA008,    /* flags => menu title is a resource, items are resources, */
  129.                /* menu is enabled, don't use XOR highlighting, std menu,  */
  130.                /* caching ok */
  131.     kFileMID,  /* ref to menu's title */
  132.     {          /* array of items in this menu */
  133.         kNewItem,
  134.         kOpenItem,
  135.         kCloseItem,
  136.         kSaveItem,
  137.         kSaveAsItem,
  138.         kQuitItem
  139.     };
  140. };
  141.  
  142. resource rPString (kFileMID, nocrossbank)
  143. {
  144.     " File "   /* this string is the title of the "File" menu */
  145. };
  146.  
  147. resource rMenuItem (kNewItem, nocrossbank)
  148. {
  149.     kNewItem,  /* item's ID */
  150.     "N",       /* keyboard equivalent = "N" */
  151.     "n",       /* or = "n" (either key will work) */
  152.     0,         /* this item does not have a check mark by it */
  153.     0x8000,    /* title is in a resource, enabled (bit 7 = 0)  */
  154.     kNewItem   /* ref of the item's title */
  155. };
  156.  
  157. resource rPString (kNewItem, nocrossbank)
  158. {
  159.     "New"      /* this string is used as the title for the "New" item */
  160. };
  161.  
  162. resource rMenuItem (kOpenItem, nocrossbank)
  163. {
  164.     kOpenItem,
  165.     "O",       /* that's an "OH" on this line, not a "zero" */
  166.     "o",       /* that's an "OH" on this line, not a "zero" */
  167.     0,         /* this one's a "zero" */
  168.     0x8040,    /* the "4" means put a dividing line under this item */
  169.     kOpenItem
  170. };
  171.  
  172. resource rPString (kOpenItem, nocrossbank)
  173. {
  174.     "Open..."
  175. };
  176.  
  177. resource rMenuItem (kCloseItem, nocrossbank)
  178. {
  179.     kCloseItem,
  180.     "W",
  181.     "w",
  182.     0,
  183.     0x8000,
  184.     kCloseItem
  185. };
  186.  
  187. resource rPString (kCloseItem, nocrossbank)
  188. {
  189.     "Close"
  190. };
  191.  
  192. resource rMenuItem (kSaveItem, nocrossbank)
  193. {
  194.     kSaveItem,
  195.     "S",
  196.     "s",
  197.     0,
  198.     0x8000,
  199.     kSaveItem
  200. };
  201.  
  202. resource rPString (kSaveItem, nocrossbank)
  203. {
  204.     "Save"
  205. };
  206.  
  207. resource rMenuItem (kSaveAsItem, nocrossbank)
  208. {
  209.     kSaveAsItem,
  210.     "",        /* no key equivalents for this item */
  211.     "",
  212.     0,
  213.     0x8000,
  214.     kSaveAsItem    
  215. };
  216.  
  217. resource rPString (kSaveAsItem, nocrossbank)
  218. {
  219.     "Save As..."
  220. };
  221.  
  222. resource rMenuItem (kQuitItem, nocrossbank)
  223. {
  224.     kQuitItem,
  225.     "Q",
  226.     "q",
  227.     0,
  228.     0x8000,
  229.     kQuitItem    
  230. };
  231.  
  232. resource rPString (kQuitItem, nocrossbank)
  233. {
  234.     "Quit"
  235. };
  236.  
  237.  
  238.     /* lay out the Edit menu */
  239.     
  240. resource rMenu (kEditMID, nocrossbank)
  241. {
  242.     kEditMID,    /* ID of the menu this item belongs to */
  243.     0xA008,
  244.     kEditMID,    /* ref to menu's title */
  245.     {            /* array of items in this menu */
  246.         kUndoItem,
  247.         kCutItem,
  248.         kCopyItem,
  249.         kPasteItem,
  250.         kClearItem,
  251.         kSelectItem,
  252.         kShowClipItem
  253.     };
  254. };
  255.  
  256. resource rPString (kEditMID, nocrossbank)
  257. {
  258.     " Edit "   /* this string is the title of the "Edit" menu */
  259. };
  260.  
  261. resource rMenuItem (kUndoItem, nocrossbank)
  262. {
  263.     kUndoItem,
  264.     "Z",
  265.     "z",
  266.     0,
  267.     0x8040,
  268.     kUndoItem
  269. };
  270.  
  271. resource rPString (kUndoItem, nocrossbank)
  272. {
  273.     "Undo"
  274. };
  275.  
  276. resource rMenuItem (kCutItem, nocrossbank)
  277. {
  278.     kCutItem,
  279.     "X",
  280.     "x",
  281.     0,
  282.     0x8000,
  283.     kCutItem
  284. };
  285.  
  286. resource rPString (kCutItem, nocrossbank)
  287. {
  288.     "Cut"
  289. };
  290.  
  291. resource rMenuItem (kCopyItem, nocrossbank)
  292. {
  293.     kCopyItem,
  294.     "C",
  295.     "c",
  296.     0,
  297.     0x8000,
  298.     kCopyItem
  299. };
  300.  
  301. resource rPString (kCopyItem, nocrossbank)
  302. {
  303.     "Copy"
  304. };
  305.  
  306. resource rMenuItem (kPasteItem, nocrossbank)
  307. {
  308.     kPasteItem,
  309.     "V",
  310.     "v",
  311.     0,
  312.     0x8000,
  313.     kPasteItem
  314. };
  315.  
  316. resource rPString (kPasteItem, nocrossbank)
  317. {
  318.     "Paste"
  319. };
  320.  
  321. resource rMenuItem (kClearItem, nocrossbank)
  322. {
  323.     kClearItem,
  324.     "",
  325.     "",
  326.     0,
  327.     0x8000,
  328.     kClearItem
  329. };
  330.  
  331. resource rPString (kClearItem, nocrossbank)
  332. {
  333.     "Clear"
  334. };
  335.  
  336. resource rMenuItem (kSelectItem, nocrossbank)
  337. {
  338.     kSelectItem,
  339.     "A",
  340.     "a",
  341.     0,
  342.     0x8040,  /* the "4" means this one has a divider under it */
  343.     kSelectItem
  344. };
  345.  
  346. resource rPString (kSelectItem, nocrossbank)
  347. {
  348.     "Select All"
  349. };
  350.  
  351. resource rMenuItem (kShowClipItem, nocrossbank)
  352. {
  353.     kShowClipItem,
  354.     "",
  355.     "",
  356.     0,
  357.     0x8000,
  358.     kShowClipItem
  359. };
  360.  
  361. resource rPString (kShowClipItem, nocrossbank)
  362. {
  363.     "Show Clipboard"
  364. };
  365.